package org.karelun.gef.figure;

import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

/**
 * @author Karelun huang
 *
 */
public class UserCaseFigure extends NodeFigure {
	
	private Ellipse ellipse;
	
    public UserCaseFigure() {      
        label=new Label();
         ellipse = new Ellipse();
		setOpaque(true);
		
		BorderLayout layout = new BorderLayout();
		setLayoutManager(layout);
		
		add(ellipse,BorderLayout.CENTER);
		ellipse.add(label,BorderLayout.CENTER);
    }

    public void setBounds(Rectangle rect) {
        super.setBounds(rect);
        this.label.setBounds(rect);
    }

	@Override
	protected void setBGColor(Color color) {
		if(ellipse==null)
			return ;
		ellipse.setBackgroundColor(color);
	}
}